//路由配置
(function() {

var Form = APM.Formreport = createApp("form");

function heightScroll (){
	setTimeout(function(){
		 $(".application-main").css("overflow-y","scroll");
		 $(".application-main").height($(window).height()-49);
		 $(window).on("resize."+this.elementId, function(){
 			$(".application-main").height($(window).height()-49);		
 		 });
	},10)
}
Form.routerMap(function() {
	this.route("navigation");
	this.route("performance");
	this.route("availability");
	this.route("systemfailure");
	this.route("totalranking");
	this.route("slowest");
	this.route("abnormal");
	this.route("slowestHTTP");
	this.route("errorHTTP");
	this.route("slowestSQL");
	this.route("errorSQL");
	this.route("systemperformance");
	this.route("banking");
});

APM.FormRoute = Form.Route.extend({
	templates: [
		{
			name: "main/frame",
			url: "/apps/main/tpls/main_frame.hbs"
		}
	],

	dependences: [
		"/apps/main/ctrls/frame_ctrl",
		"/apps/main/views/frame_view",
	],

	renderTemplate: function(){
		this.render("main/frame", {controller: "mainFrame", view: "mainFrame"});
	}
});

APM.FormIndexRoute = Form.Route.extend({
	redirect : function() {
		this.transitionTo("form.navigation");
	}
});

/*---------路由定义----------- */

// 报表
APM.FormNavigationRoute = Form.Route.extend({

	dependences: [
		"/apps/form/ctrls/navigation_ctrl",
		"/apps/form/views/navigation_view"
	],

	setupController: function(ctrl, params, transition) {
		setTimeout(function(){
			 $(".application-main").css("overflow-y","scroll");
			 $(".application-main").height($(window).height()-49);
			 $(window).on("resize."+this.elementId, function(){
	 			$(".application-main").height($(window).height()-49);		
	 		 });
		},10)
	}
});

//核心系统关键交易性能报表
APM.FormPerformanceRoute = Form.Route.extend({

	dependences: [
		"/apps/form/ctrls/performance_ctrl",
		"/apps/form/views/performance_view"
	],

	setupController: function(ctrl, params, transition) {
		ctrl.requireApplications();
		ctrl.reportformData();
		setTimeout(function(){
			 $(".application-main").css("overflow-y","scroll");
			 $(".application-main").height($(window).height()-49);
			 $(window).on("resize."+this.elementId, function(){
	 			$(".application-main").height($(window).height()-49);		
	 		 });
		},10)
	}
});

//系统可用性报表
APM.FormAvailabilityRoute = Form.Route.extend({

	dependences: [
		"/apps/form/ctrls/availability_ctrl",
		"/apps/form/views/availability_view"
	],

	setupController: function(ctrl, params, transition) {
		ctrl.reportformData();
		heightScroll();
	}
});

//系统故障报表
APM.FormSystemfailureRoute = Form.Route.extend({

	dependences: [
		"/apps/form/ctrls/systemfailure_ctrl",
		"/apps/form/views/systemfailure_view"
	],

	setupController: function(ctrl, params, transition) {
		ctrl.reportformData();
		heightScroll();
	}
});

//交易量总排行
APM.FormTotalrankingRoute = Form.Route.extend({

	dependences: [
		"/apps/form/ctrls/totalranking_ctrl",
		"/apps/form/views/totalranking_view"
	],

	setupController: function(ctrl, params, transition) {
		ctrl.set("formTopValue",10);
		ctrl.reportformData();
		heightScroll();
	}
});

//最慢交易排行
APM.FormSlowestRoute = Form.Route.extend({

	dependences: [
		"/apps/form/ctrls/slowest_ctrl",
		"/apps/form/views/slowest_view"
	],

	setupController: function(ctrl, params, transition) {
		ctrl.reportformData();
		heightScroll();
	}
});

//异常交易排行
APM.FormAbnormalRoute = Form.Route.extend({

	dependences: [
		"/apps/form/ctrls/abnormal_ctrl",
		"/apps/form/views/abnormal_view"
	],

	setupController: function(ctrl, params, transition) {
		ctrl.reportformData();
		heightScroll();
	}
});

//最慢HTTP页面排行

APM.FormSlowestHTTPRoute = Form.Route.extend({

	dependences: [
		"/apps/form/ctrls/slowestHTTP_ctrl",
		"/apps/form/views/slowestHTTP_view"
	],

	setupController: function(ctrl, params, transition) {
		ctrl.requireApplications();
		ctrl.reportformData();
		heightScroll();
	}
});


//错误HTTP页面排行

APM.FormErrorHTTPRoute = Form.Route.extend({

	dependences: [
		"/apps/form/ctrls/errorHTTP_ctrl",
		"/apps/form/views/errorHTTP_view"
	],

	setupController: function(ctrl, params, transition) {
		ctrl.requireApplications();
		ctrl.reportformData();
		heightScroll();
	}
});

//最慢SQL排行

APM.FormSlowestSQLRoute = Form.Route.extend({

	dependences: [
		"/apps/form/ctrls/slowestSQL_ctrl",
		"/apps/form/views/slowestSQL_view"
	],

	setupController: function(ctrl, params, transition) {
		ctrl.requireApplications();
		ctrl.reportformData();
		heightScroll();
	}
});

//错误SQL排行

APM.FormErrorSQLRoute = Form.Route.extend({

	dependences: [
		"/apps/form/ctrls/errorSQL_ctrl",
		"/apps/form/views/errorSQL_view"
	],

	setupController: function(ctrl, params, transition) {
		ctrl.requireApplications();
		ctrl.reportformData();
		heightScroll();
	}
});


//系统性能报表

APM.FormSystemperformanceRoute = Form.Route.extend({

	dependences: [
		"/apps/form/ctrls/systemperformance_ctrl",
		"/apps/form/views/systemperformance_view"
	],

	setupController: function(ctrl, params, transition) {
		ctrl.reportformData();
		heightScroll();
	}
});

//银监会动态监测指标日报

APM.FormBankingRoute = Form.Route.extend({

	dependences: [
		"/apps/form/ctrls/banking_ctrl",
		"/apps/form/views/banking_view"
	],

	setupController: function(ctrl, params, transition) {
		ctrl.reportformData();
		heightScroll();
	}
});

})();